# Copyright (C) 2007 "dbsolution sas" 
#
# This file is part of Weebotee.
#
# Weebotee is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Weebotee is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Weebotee.  If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls.defaults import *
from django.conf import settings
from libs.plug_core import load_plug_urls, load_plug_services_urls

handler404 = handler500 = 'libs.dispatchers.dispatchers.custom404view'

urlpatterns = patterns('',
   ( r'^%s(?P<path>.*)$' % settings.MEDIA_PREFIX[1:], 
     'django.views.static.serve', 
     {'document_root':settings.MEDIA_ROOT, 'show_indexes':True}),
)

urlpatterns += patterns('',                  
   #filebrowser
   (r'^admin/filebrowser/', include('apps.filebrowser.urls')),
   
   #admin                     
   (r'^scaffold/', include('django.contrib.admin.urls')),
   (r'^admin/', include('apps.core.backend.urls')),
   (r'', include('apps.core.frontend.urls')),
                        
    #login/logout
   (r'^accounts/login/$', 'apps.core.backend.views.auth.loginView'),
   (r'^accounts/logout/$', 'apps.core.backend.views.auth.logoutView'),
   (r'^accounts/register/$', 'apps.core.backend.views.users.registerUser'),
)


urlpatterns+= patterns('', *load_plug_urls())
urlpatterns+= patterns('', *load_plug_services_urls())
